using System.Linq;
using System.Diagnostics.Contracts;
using System.Collections.Generic;
using System;
using System.Web.Mvc;

using $safeprojectname$.Service;

namespace $safeprojectname$
{
    public interface IEntityBinder<TEntity, in TID>
        where TEntity : class, IPersistentObjectWithTypedId<TID>
    {
        /// <summary>
        ///     Binds the Entity with data coming in passed IValueContainer.
        ///     Could be used for UI binding as well as for any other purposes,
        ///     e.g. MS Excel import.
        ///     When overriden it could map or bind complex structures or inner entities.
        /// </summary>
        /// <example>
        ///     See LanguageFacade
        /// </example>
        /// <param name = "entity"></param>
        /// <param name = "valueProvider"></param>
        /// <param name="prefix">e.g. "Address". Outter entity asks Inner entity Facade for property binding</param>
        /// <param name="includeProperties"></param>
        /// <param name="excludeProperties"></param>
        /// <returns></returns>
        TEntity BindEntity(TEntity entity
            , IValueContainer valueProvider
            , string prefix = null
            , string[] includeProperties = null
            , string[] excludeProperties = null);
    }
}